
// service
import {
  simplePageService,
  simpleResService,
  simpleObjectService,
} from "public/service/simple.service";
// api
import {
  API_REMARK_UPDATE,
  API_USER_ADD,
  API_USER_CODE,
  API_USER_DEL,
  API_USER_DETAIL,
  API_USER_PAGE,
  API_USER_STATUS,
  ReqRemarkUpdate,
  ReqUserAdd,
  ReqUserCode,
  ReqUserDel,
  ReqUserPage,
  ReqUserStatus,
} from "./api";
// interface

// 用户分页
export async function getUserPageService(params: ReqUserPage) {
  const result = await simplePageService<ReqUserPage, UserDto>(
    API_USER_PAGE,
    params,
  );
  return result;
}

// 用户备注编辑
export async function updateRemarkService(params: ReqRemarkUpdate) {
  return simpleResService<ReqRemarkUpdate>(API_REMARK_UPDATE, params);
}

// 用户详情
export async function getUserDetailService(params: string) {
  return simpleObjectService<ReqById, UserDto>(API_USER_DETAIL, {
    id: params,
  });
}

// 用户添加
export async function addUserService(params: ReqUserAdd) {
  return simpleResService<ReqUserAdd>(API_USER_ADD, params);
}

// 用户验证码
export async function getUserCodeService(params: string) {
  return simpleResService<ReqUserCode>(API_USER_CODE, {
    mobile: params,
  });
}

// 用户删除
export async function delUserService(id: string) {
  return simpleResService<ReqUserDel>(API_USER_DEL, {
    permId: id,
  });
}

// 用户删除
export async function setUserStatusService(params: ReqUserStatus) {
  return simpleResService<ReqUserStatus>(API_USER_STATUS, params);
}


